
<!doctype html>
<html lang="en" class="no-js">
  <head>
    
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width,initial-scale=1">
      
        <meta name="description" content="ESP8266/ESP32 WLAN configuration at run time with web interface">
      
      
        <meta name="author" content="Hieromon Ikasamo">
      
      
        <link rel="canonical" href="https://Hieromon.github.io/AutoConnect/adconnection.html">
      
      
        <link rel="prev" href="advancedusage.html">
      
      
        <link rel="next" href="adcpcontrol.html">
      
      <link rel="icon" href="assets/images/favicon.png">
      <meta name="generator" content="mkdocs-1.4.2, mkdocs-material-9.0.9">
    
    
      
        <title>AutoConnect WiFi connection control - AutoConnect for ESP8266/ESP32</title>
      
    
    
      <link rel="stylesheet" href="assets/stylesheets/main.0d440cfe.min.css">
      
        
        <link rel="stylesheet" href="assets/stylesheets/palette.2505c338.min.css">
      
      

    
    
    
      
        
        
        <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
        <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&display=fallback">
        <style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style>
      
    
    
      <link rel="stylesheet" href="css/paragraph.css">
    
      <link rel="stylesheet" href="css/extra.css">
    
      <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.14.0/css/all.css">
    
    <script>__md_scope=new URL(".",location),__md_hash=e=>[...e].reduce((e,_)=>(e<<5)-e+_.charCodeAt(0),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
    
      
  


  
  


  <script id="__analytics">function __md_analytics(){function n(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],n("js",new Date),n("config","G-EHK8XV10VE"),document.addEventListener("DOMContentLoaded",function(){document.forms.search&&document.forms.search.query.addEventListener("blur",function(){this.value&&n("event","search",{search_term:this.value})}),document$.subscribe(function(){var a=document.forms.feedback;if(void 0!==a)for(var e of a.querySelectorAll("[type=submit]"))e.addEventListener("click",function(e){e.preventDefault();var t=document.location.pathname,e=this.getAttribute("data-md-value");n("event","feedback",{page:t,data:e}),a.firstElementChild.disabled=!0;e=a.querySelector(".md-feedback__note [data-md-value='"+e+"']");e&&(e.hidden=!1)}),a.hidden=!1}),location$.subscribe(function(e){n("config","G-EHK8XV10VE",{page_path:e.pathname})})});var e=document.createElement("script");e.async=!0,e.src="https://www.googletagmanager.com/gtag/js?id=G-EHK8XV10VE",document.getElementById("__analytics").insertAdjacentElement("afterEnd",e)}</script>

  
    <script>"undefined"!=typeof __md_analytics&&__md_analytics()</script>
  

    
    
    
  </head>
  
  
    
    
    
    
    
    <body dir="ltr" data-md-color-scheme="default" data-md-color-primary="indigo" data-md-color-accent="indigo">
  
    
    
    <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
    <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
    <label class="md-overlay" for="__drawer"></label>
    <div data-md-component="skip">
      
        
        <a href="#automatic-reconnect" class="md-skip">
          Skip to content
        </a>
      
    </div>
    <div data-md-component="announce">
      
    </div>
    
    
      

<header class="md-header" data-md-component="header">
  <nav class="md-header__inner md-grid" aria-label="Header">
    <a href="index.html" title="AutoConnect for ESP8266/ESP32" class="md-header__button md-logo" aria-label="AutoConnect for ESP8266/ESP32" data-md-component="logo">
      
  <img src="images/arduino-logo.svg" alt="logo">

    </a>
    <label class="md-header__button md-icon" for="__drawer">
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2Z"/></svg>
    </label>
    <div class="md-header__title" data-md-component="header-title">
      <div class="md-header__ellipsis">
        <div class="md-header__topic">
          <span class="md-ellipsis">
            AutoConnect for ESP8266/ESP32
          </span>
        </div>
        <div class="md-header__topic" data-md-component="header-topic">
          <span class="md-ellipsis">
            
              AutoConnect WiFi connection control
            
          </span>
        </div>
      </div>
    </div>
    
    
    
      <label class="md-header__button md-icon" for="__search">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"/></svg>
      </label>
      <div class="md-search" data-md-component="search" role="dialog">
  <label class="md-search__overlay" for="__search"></label>
  <div class="md-search__inner" role="search">
    <form class="md-search__form" name="search">
      <input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required>
      <label class="md-search__icon md-icon" for="__search">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"/></svg>
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12Z"/></svg>
      </label>
      <nav class="md-search__options" aria-label="Search">
        
        <button type="reset" class="md-search__icon md-icon" title="Clear" aria-label="Clear" tabindex="-1">
          <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41Z"/></svg>
        </button>
      </nav>
      
    </form>
    <div class="md-search__output">
      <div class="md-search__scrollwrap" data-md-scrollfix>
        <div class="md-search-result" data-md-component="search-result">
          <div class="md-search-result__meta">
            Initializing search
          </div>
          <ol class="md-search-result__list" role="presentation"></ol>
        </div>
      </div>
    </div>
  </div>
</div>
    
    
      <div class="md-header__source">
        <a href="https://github.com/Hieromon/AutoConnect" title="Go to repository" class="md-source" data-md-component="source">
  <div class="md-source__icon md-icon">
    
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.2.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc.--><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81z"/></svg>
  </div>
  <div class="md-source__repository">
    Hieromon/AutoConnect
  </div>
</a>
      </div>
    
  </nav>
  
</header>
    
    <div class="md-container" data-md-component="container">
      
      
        
          
        
      
      <main class="md-main" data-md-component="main">
        <div class="md-main__inner md-grid">
          
            
              
              <div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
                <div class="md-sidebar__scrollwrap">
                  <div class="md-sidebar__inner">
                    


<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
  <label class="md-nav__title" for="__drawer">
    <a href="index.html" title="AutoConnect for ESP8266/ESP32" class="md-nav__button md-logo" aria-label="AutoConnect for ESP8266/ESP32" data-md-component="logo">
      
  <img src="images/arduino-logo.svg" alt="logo">

    </a>
    AutoConnect for ESP8266/ESP32
  </label>
  
    <div class="md-nav__source">
      <a href="https://github.com/Hieromon/AutoConnect" title="Go to repository" class="md-source" data-md-component="source">
  <div class="md-source__icon md-icon">
    
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.2.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc.--><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81z"/></svg>
  </div>
  <div class="md-source__repository">
    Hieromon/AutoConnect
  </div>
</a>
    </div>
  
  <ul class="md-nav__list" data-md-scrollfix>
    
      
      
      

  
  
  
    <li class="md-nav__item">
      <a href="index.html" class="md-nav__link">
        Overview
      </a>
    </li>
  

    
      
      
      

  
  
  
    <li class="md-nav__item">
      <a href="gettingstarted.html" class="md-nav__link">
        Getting started
      </a>
    </li>
  

    
      
      
      

  
  
  
    <li class="md-nav__item">
      <a href="menu.html" class="md-nav__link">
        AutoConnect menu
      </a>
    </li>
  

    
      
      
      

  
  
  
    <li class="md-nav__item">
      <a href="basicusage.html" class="md-nav__link">
        Basic usage
      </a>
    </li>
  

    
      
      
      

  
  
    
  
  
    
    <li class="md-nav__item md-nav__item--active md-nav__item--nested">
      
      
      
      
      <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5" checked>
      
      
      
        <label class="md-nav__link" for="__nav_5" id="__nav_5_label" tabindex="0">
          Advanced usage
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_5_label" aria-expanded="true">
        <label class="md-nav__title" for="__nav_5">
          <span class="md-nav__icon md-icon"></span>
          Advanced usage
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="advancedusage.html" class="md-nav__link">
        Advanced usage
      </a>
    </li>
  

            
          
            
              
  
  
    
  
  
    <li class="md-nav__item md-nav__item--active">
      
      <input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
      
      
      
        <label class="md-nav__link md-nav__link--active" for="__toc">
          AutoConnect WiFi connection control
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <a href="adconnection.html" class="md-nav__link md-nav__link--active">
        AutoConnect WiFi connection control
      </a>
      
        

<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
  
  
  
  
    <label class="md-nav__title" for="__toc">
      <span class="md-nav__icon md-icon"></span>
      Table of contents
    </label>
    <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
      
        <li class="md-nav__item">
  <a href="#automatic-reconnect" class="md-nav__link">
    Automatic reconnect
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#automatic-reconnect-background" class="md-nav__link">
    Automatic reconnect (Background)
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#configure-wifi-channel" class="md-nav__link">
    Configure WiFi channel
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#connects-depending-on-the-wifi-signal-strength" class="md-nav__link">
    Connects depending on the WiFi signal strength
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#detects-connection-establishment-to-ap" class="md-nav__link">
    Detects connection establishment to AP
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#match-with-known-access-points-by-ssid" class="md-nav__link">
    Match with known access points by SSID
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#preserve-ap-mode" class="md-nav__link">
    Preserve AP mode
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#timeout-settings-for-a-connection-attempt" class="md-nav__link">
    Timeout settings for a connection attempt
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#verify-the-wifi-connection-conditions" class="md-nav__link">
    Verify the WiFi connection conditions
  </a>
  
</li>
      
    </ul>
  
</nav>
      
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="adcpcontrol.html" class="md-nav__link">
        Captive portal control
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="adnetwork.html" class="md-nav__link">
        Settings and controls for network and WiFi
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="adauthentication.html" class="md-nav__link">
        Authentication settings
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="adcredential.html" class="md-nav__link">
        Credential accesses
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="adexterior.html" class="md-nav__link">
        Customizing page appearance
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="adothers.html" class="md-nav__link">
        Other operation settings and controls
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

    
      
      
      

  
  
  
    
    <li class="md-nav__item md-nav__item--nested">
      
      
      
      
      <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_6" >
      
      
      
        <label class="md-nav__link" for="__nav_6" id="__nav_6_label" tabindex="0">
          Custom Web pages
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_6_label" aria-expanded="false">
        <label class="md-nav__title" for="__nav_6">
          <span class="md-nav__icon md-icon"></span>
          Custom Web pages
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="acintro.html" class="md-nav__link">
        Custom Web pages with AutoConnect
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="acelements.html" class="md-nav__link">
        AutoConnectElements
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="acjson.html" class="md-nav__link">
        Custom Web pages with JSON
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="achandling.html" class="md-nav__link">
        Handling the custom Web pages
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="acinteract.html" class="md-nav__link">
        Interact between Sketch and AutoConnectElements
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

    
      
      
      

  
  
  
    
    <li class="md-nav__item md-nav__item--nested">
      
      
      
      
      <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_7" >
      
      
      
        <label class="md-nav__link" for="__nav_7" id="__nav_7_label" tabindex="0">
          OTA Updates
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_7_label" aria-expanded="false">
        <label class="md-nav__title" for="__nav_7">
          <span class="md-nav__icon md-icon"></span>
          OTA Updates
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="otaupdate.html" class="md-nav__link">
        OTA Updates
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="otabrowser.html" class="md-nav__link">
        OTA via Web Browser
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="otaserver.html" class="md-nav__link">
        OTA using Update Server
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

    
      
      
      

  
  
  
    <li class="md-nav__item">
      <a href="filesystem.html" class="md-nav__link">
        Using Filesystem
      </a>
    </li>
  

    
      
      
      

  
  
  
    
    <li class="md-nav__item md-nav__item--nested">
      
      
      
      
      <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_9" >
      
      
      
        <label class="md-nav__link" for="__nav_9" id="__nav_9_label" tabindex="0">
          Library APIs
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_9_label" aria-expanded="false">
        <label class="md-nav__title" for="__nav_9">
          <span class="md-nav__icon md-icon"></span>
          Library APIs
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="api.html" class="md-nav__link">
        AutoConnect API
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="apiaux.html" class="md-nav__link">
        AutoConnectAux API
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="apiconfig.html" class="md-nav__link">
        AutoConnectConfig API
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="apielements.html" class="md-nav__link">
        AutoConnectElements API
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="apiupdate.html" class="md-nav__link">
        AutoConnectUpdate API
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="apiextra.html" class="md-nav__link">
        Something extra
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

    
      
      
      

  
  
  
    
    <li class="md-nav__item md-nav__item--nested">
      
      
      
      
      <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_10" >
      
      
      
        <label class="md-nav__link" for="__nav_10" id="__nav_10_label" tabindex="0">
          Examples
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_10_label" aria-expanded="false">
        <label class="md-nav__title" for="__nav_10">
          <span class="md-nav__icon md-icon"></span>
          Examples
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="howtoembed.html" class="md-nav__link">
        How to embed
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="datatips.html" class="md-nav__link">
        Tips for data conversion
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="menuize.html" class="md-nav__link">
        Attach the menus
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="wojson.html" class="md-nav__link">
        Custom Web pages w/o JSON
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="esp32cam.html" class="md-nav__link">
        Works with ESP32-CAM
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

    
      
      
      

  
  
  
    
    <li class="md-nav__item md-nav__item--nested">
      
      
      
      
      <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_11" >
      
      
      
        <label class="md-nav__link" for="__nav_11" id="__nav_11_label" tabindex="0">
          Appendix
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_11_label" aria-expanded="false">
        <label class="md-nav__title" for="__nav_11">
          <span class="md-nav__icon md-icon"></span>
          Appendix
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="lsbegin.html" class="md-nav__link">
        Inside AutoConnect::begin
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="credit.html" class="md-nav__link">
        Saved credentials access
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="acupload.html" class="md-nav__link">
        File upload handler
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="colorized.html" class="md-nav__link">
        Custom colorized
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="changelabel.html" class="md-nav__link">
        Change label text
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

    
      
      
      

  
  
  
    <li class="md-nav__item">
      <a href="faq.html" class="md-nav__link">
        FAQ
      </a>
    </li>
  

    
      
      
      

  
  
  
    <li class="md-nav__item">
      <a href="changelog.html" class="md-nav__link">
        Change log
      </a>
    </li>
  

    
      
      
      

  
  
  
    <li class="md-nav__item">
      <a href="license.html" class="md-nav__link">
        License
      </a>
    </li>
  

    
  </ul>
</nav>
                  </div>
                </div>
              </div>
            
            
              
              <div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
                <div class="md-sidebar__scrollwrap">
                  <div class="md-sidebar__inner">
                    

<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
  
  
  
  
    <label class="md-nav__title" for="__toc">
      <span class="md-nav__icon md-icon"></span>
      Table of contents
    </label>
    <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
      
        <li class="md-nav__item">
  <a href="#automatic-reconnect" class="md-nav__link">
    Automatic reconnect
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#automatic-reconnect-background" class="md-nav__link">
    Automatic reconnect (Background)
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#configure-wifi-channel" class="md-nav__link">
    Configure WiFi channel
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#connects-depending-on-the-wifi-signal-strength" class="md-nav__link">
    Connects depending on the WiFi signal strength
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#detects-connection-establishment-to-ap" class="md-nav__link">
    Detects connection establishment to AP
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#match-with-known-access-points-by-ssid" class="md-nav__link">
    Match with known access points by SSID
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#preserve-ap-mode" class="md-nav__link">
    Preserve AP mode
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#timeout-settings-for-a-connection-attempt" class="md-nav__link">
    Timeout settings for a connection attempt
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#verify-the-wifi-connection-conditions" class="md-nav__link">
    Verify the WiFi connection conditions
  </a>
  
</li>
      
    </ul>
  
</nav>
                  </div>
                </div>
              </div>
            
          
          
            <div class="md-content" data-md-component="content">
              <article class="md-content__inner md-typeset">
                
                  



  <h1>AutoConnect WiFi connection control</h1>

<p>AutoConnect aims to connect the ESP module as a station to a WiFi access point and equips with various APIs to maintain a WiFi connection as possible while sketch running. The main APIs are <a href="api.html#begin">AutoConnect::begin</a> and <a href="api.html#handleclient">AutoConnect::handleClient</a>. You can make sketches with flexible WiFi connection capability by properly using these two APIs and the settings by <a href="apiconfig.html">AutoConnectConfig</a>.</p>
<ul>
<li><a href="#automatic-reconnect">Automatic reconnect</a></li>
<li><a href="#automatic-reconnect-background">Automatic reconnect (Background)</a></li>
<li><a href="#configure-wifi-channel">Configure WiFi channel</a></li>
<li><a href="#connects-depending-on-the-wifi-signal-strength">Connects depending on the WiFi signal strength</a></li>
<li><a href="#detects-connection-establishment-to-ap">Detects connection establishment to AP</a></li>
<li><a href="#match-with-known-access-points-by-ssid">Match with known access points by SSID</a></li>
<li><a href="#preserve-ap-mode">Preserve AP mode</a></li>
<li><a href="#timeout-settings-for-a-connection-attempt">Timeout settings for a connection attempt</a></li>
<li><a href="#verify-the-wifi-connection-conditions">Verify the WiFi connection conditions</a></li>
</ul>
<h2 id="automatic-reconnect">Automatic reconnect<a class="headerlink" href="#automatic-reconnect" title="Permanent link">&para;</a></h2>
<p>AutoConnect will change the WiFi mode depending on the situation. The <a href="lsbegin.html">AutoConnect::begin</a> function starts the Web Server with <strong>WIFI_STA</strong> mode when the connection is successful with <a href="lsbegin.html"><em>1<sup>st</sup>-WiFi.begin</em></a>. If the connection with the last access point fails, AutoConnect will switch the WiFi mode to <strong>WIFI_AP_STA</strong>, launching a DNS server and allowing the ESP module to launch the captive portal.</p>
<p>The captive portal launches SoftAP at its start and disconnects the STA. At this time, the ESP module discards its stored station configuration data (known as the SDK's <a href="https://github.com/esp8266/Arduino/blob/db75d2c448bfccc6dc308bdeb9fbd3efca7927ff/tools/sdk/include/user_interface.h#L249">station_config</a> structure). This is the default behavior of AutoConnect.</p>
<p>On the other hand, AutoConnect can connect to an access point again that has disconnected once, and its control is allowed by <a href="apiconfig.html#autoreconnect"><em>AutoConnectConfig::autoReconnect</em></a> that option specifies to attempt to reconnect to the past established access point using the saved credentials. If the <a href="apiconfig.html#autoreconnect"><strong>autoReconnect</strong></a> is enabled, AutoConnect will not launch SoftAP immediately even if <em>1<sup>st</sup>-WiFi.begin</em> fails. When AutoConnect fails WiFi connection, it will scan the WiFi signal and try to find the access point that the ESP module has connected to in the past. If AutoConnect finds one of the saved credentials from the broadcast with BSSID, it will explicitly apply the matching credential and attempt to reconnect while in WIFI_STA mode. (AutoReconnect works well even with hidden SSID access points)</p>
<div class="highlight" style="background: #272822"><pre style="line-height: 125%;"><span></span><code><span style="color: #f8f8f2">AutoConnect       Portal;</span>
<span style="color: #f8f8f2">AutoConnectConfig Config;</span>
<span style="background-color: #49483e"><span style="color: #f8f8f2">Config.autoReconnect </span><span style="color: #f92672">=</span><span style="color: #f8f8f2"> true;</span>
</span><span style="color: #f8f8f2">Portal.config(Config);</span>
<span style="color: #f8f8f2">Portal.begin();</span>
</code></pre></div>
<p>The <a href="apiconfig.html#autoreconnect"><strong>autoReconnect</strong></a> option is only available for <a href="api.html#begin">AutoConnect::begin</a> without SSID and PASSWORD parameter. If you use <a href="api.html#begin">AutoConnect::begin</a> with an SSID and PASSWORD, no reconnection attempt will be made if the 1<sup>st</sup>-WiFi.begin fails to connect to that SSID.</p>
<div class="admonition note">
<p class="admonition-title">The autoReconnect is not autoreconnect</p>
<p>The <a href="https://github.com/espressif/arduino-esp32/blob/a0f0bd930cfd2d607bf3d3288f46e2d265dd2e11/libraries/WiFi/src/WiFiSTA.h#L46"><em>WiFiSTAClass::disconnect</em></a> function implemented in the arduino-esp32 has extended parameters than the ESP8266's arduino-core. The second parameter of WiFi.disconnect on the arduino-esp32 core that does not exist in the <a href="https://github.com/esp8266/Arduino/blob/7e1bdb225da8ab337373517e6a86a99432921a86/libraries/ESP8266WiFi/src/ESP8266WiFiSTA.cpp#L296">ESP8266WiFiSTAClass</a> has the effect of deleting the currently connected WiFi configuration and its default value is "false". On the ESP32 platform, even if WiFi.disconnect is executed, WiFi.begin without the parameters in the next turn will try to connect to that AP. That is, automatic reconnection is implemented in arduino-esp32 already. Although this behavior appears seemingly competent, it is rather a disadvantage in scenes where you want to change the access point each time. When explicitly disconnecting WiFi from the Disconnect menu, AutoConnect will erase the AP connection settings saved by the arduino-esp32 core. AutoConnect's automatic reconnection is a mechanism independent from the automatic reconnection of the arduino-esp32 core.</p>
</div>
<h2 id="automatic-reconnect-background">Automatic reconnect (Background)<a class="headerlink" href="#automatic-reconnect-background" title="Permanent link">&para;</a></h2>
<p>Combining <a href="advancedusage.html#automatic-reconnect"><strong>autoReconnect</strong></a> with <a href="apiconfig.html#reconnectinterval"><em>AutoConnectConfig::reconnectInterval</em></a> allows you to periodically repeat connection attempts to known access points within <a href="api.html#handleclient">AutoConnect::handleClient</a>. This process is pseudo-asynchronous and does not block the Sketch process in the <code>loop()</code> function.</p>
<p>The reconnectInterval specifies the interval time to seek for known access points with saved credentials during the <strong>handleClient</strong> loop and attempt to connect to the AP.</p>
<div class="highlight" style="background: #272822"><pre style="line-height: 125%;"><span></span><code><span style="color: #f8f8f2">AutoConnect       Portal;</span>
<span style="color: #f8f8f2">AutoConnectConfig Config;</span>

<span style="color: #66d9ef">void</span><span style="color: #f8f8f2"> </span><span style="color: #a6e22e">setup</span><span style="color: #f8f8f2">() {</span>
<span style="background-color: #49483e"><span style="color: #f8f8f2">  Config.autoReconnect </span><span style="color: #f92672">=</span><span style="color: #f8f8f2"> true;    </span><span style="color: #75715e">// Attempt automatic reconnection.</span>
</span><span style="background-color: #49483e"><span style="color: #f8f8f2">  Config.reconnectInterval </span><span style="color: #f92672">=</span><span style="color: #f8f8f2"> </span><span style="color: #ae81ff">6</span><span style="color: #f8f8f2">;   </span><span style="color: #75715e">// Seek interval time is 180[s].</span>
</span><span style="color: #f8f8f2">  Portal.config(Config);</span>
<span style="color: #f8f8f2">  Portal.begin();</span>
<span style="color: #f8f8f2">}</span>

<span style="color: #66d9ef">void</span><span style="color: #f8f8f2"> </span><span style="color: #a6e22e">loop</span><span style="color: #f8f8f2">() {</span>
<span style="color: #f8f8f2">  </span><span style="color: #66d9ef">if</span><span style="color: #f8f8f2"> (WiFi.status() </span><span style="color: #f92672">==</span><span style="color: #f8f8f2"> WL_CONNECTED) {</span>
<span style="color: #f8f8f2">    </span><span style="color: #75715e">// Here to do when WiFi is connected.</span>
<span style="color: #f8f8f2">  }</span>
<span style="color: #f8f8f2">  </span><span style="color: #66d9ef">else</span><span style="color: #f8f8f2"> {</span>
<span style="color: #f8f8f2">    </span><span style="color: #75715e">// Here to do when WiFi is not connected.</span>
<span style="color: #f8f8f2">  }</span>

<span style="color: #f8f8f2">  Portal.handleClient();</span>
<span style="color: #f8f8f2">}</span>
</code></pre></div>
<p>Above Sketch shows a configuration example that you want to keep connecting to known access points as long as possible. When the WiFi connection is lost, it will start seeking the WiFi network every 30 seconds during the handleClient loop.</p>
<div class="admonition info">
<p class="admonition-title">Limitation for automatic reconnection to a specific access point</p>
<p>An access point that ESP module to reconnect automatically depends on whether the SSID and password argument existence with <a href="api.html#begin">AutoConnect::begin</a>. If the Sketch calls <a href="api.html#begin">AutoConnect::begin</a> without specifying an SSID or password, the <a href="apiconfig.html#autoreconnect">autoReconnect</a> will connect to one of the detected access points and cannot be pre-determined.<br />
The other one, the case of the Sketch specifies SSID and password with <a href="api.html#begin">AutoConnect::begin</a>, the <a href="apiconfig.html#autoreconnect">autoReconnect</a> will try to reconnect to a specified access point periodically during the handleClient loop.</p>
</div>
<p>Also, you can combine the background automatic reconnect performing inside the loop function by <a href="api.html#handleclient">handleClient</a> with <a href="apiconfig.html#retainportal"><em>AutoConnectConfig::retainPortal</em></a> and <a href="apiconfig.html#autoreset"><em>AutoConnectConfig::autoReset</em></a>, to enable pop up the captive portal automatically on the client device each time the ESP module disconnects from the access point.</p>
<div class="highlight" style="background: #272822"><pre style="line-height: 125%;"><span></span><code><span style="color: #f8f8f2">AutoConnect       Portal;</span>
<span style="color: #f8f8f2">AutoConnectConfig Config;</span>

<span style="color: #66d9ef">void</span><span style="color: #f8f8f2"> </span><span style="color: #a6e22e">setup</span><span style="color: #f8f8f2">() {</span>
<span style="color: #f8f8f2">  Config.autoReset </span><span style="color: #f92672">=</span><span style="color: #f8f8f2"> false;     </span><span style="color: #75715e">// Not reset the module even by intentional disconnection using AutoConnect menu.</span>
<span style="color: #f8f8f2">  Config.autoReconnect </span><span style="color: #f92672">=</span><span style="color: #f8f8f2"> true;  </span><span style="color: #75715e">// Reconnect to known access points.</span>
<span style="color: #f8f8f2">  Config.reconnectInterval </span><span style="color: #f92672">=</span><span style="color: #f8f8f2"> </span><span style="color: #ae81ff">6</span><span style="color: #f8f8f2">; </span><span style="color: #75715e">// Reconnection attempting interval is 3[min].</span>
<span style="color: #f8f8f2">  Config.retainPortal </span><span style="color: #f92672">=</span><span style="color: #f8f8f2"> true;   </span><span style="color: #75715e">// Keep the captive portal open.</span>
<span style="color: #f8f8f2">  Portal.config(Config);</span>
<span style="color: #f8f8f2">  Portal.begin();</span>
<span style="color: #f8f8f2">}</span>

<span style="color: #66d9ef">void</span><span style="color: #f8f8f2"> </span><span style="color: #a6e22e">loop</span><span style="color: #f8f8f2">() {</span>
<span style="color: #f8f8f2">  </span><span style="color: #66d9ef">if</span><span style="color: #f8f8f2"> (WiFi.status() </span><span style="color: #f92672">==</span><span style="color: #f8f8f2"> WL_CONNECTED) {</span>
<span style="color: #f8f8f2">    </span><span style="color: #75715e">// Here to do when WiFi is connected.</span>
<span style="color: #f8f8f2">  }</span>
<span style="color: #f8f8f2">  </span><span style="color: #66d9ef">else</span><span style="color: #f8f8f2"> {</span>
<span style="color: #f8f8f2">    </span><span style="color: #75715e">// Here to do when WiFi is not connected.</span>
<span style="color: #f8f8f2">  }</span>
<span style="color: #f8f8f2">}</span>
</code></pre></div>
<div class="admonition info">
<p class="admonition-title">The effective range of the <a href="apiconfig.html#reconnectinterval">reconnectInterval</a> depending on the setting value</p>
<p>The range of values that reconnectInterval can take is 0 to 255. (Actual seconds are from 0 to 255&#xd7;AUTOCONNECT_UNITTIME)<br>
Reconnect behavior depends on the setting value. If it is 0, reconnection will work if the 1<sup>st</sup>-WiFi.begin in AutoConnect::begin fails and will suspend during the handleClient loop. If reconnectInterval is greater than 0, AutoConnect will attempt to reconnect both in AutoConnect::begin and during the handleClient loop.</p>
</div>
<h2 id="configure-wifi-channel">Configure WiFi channel<a class="headerlink" href="#configure-wifi-channel" title="Permanent link">&para;</a></h2>
<p>Appropriately specifying the WiFi channel to use for ESP8266 and ESP32 is essential for a stable connection with the access point. AutoConnect remembers the WiFi channel with a credential of the access point once connected and reuses it.</p>
<p>The default channel when a captive portal starts and AutoConnect itself becomes an access point is the <a href="apiconfig.html#channel"><em>AutoConnectConfig::channel</em></a> member. If this channel is different from the channel of the access point you will attempt to connect, WiFi.begin may fail. The cause is that the ESP module shares the same channel in AP mode and STA mode. If the connection attempt is not stable, specifying a proper channel using AutoConnectConfig::channel may result in a stable connection.</p>
<h2 id="connects-depending-on-the-wifi-signal-strength">Connects depending on the WiFi signal strength<a class="headerlink" href="#connects-depending-on-the-wifi-signal-strength" title="Permanent link">&para;</a></h2>
<p>When the ESP module found the multiple available access points (i.e. AutoConnect has connected in the past), the default behavior AutoConnect will attempt to connect to the least recent one. However, If the ESP module can operate properly with any access point, it is advantageous to establish a connection with the best one of the reception sensitivity. </p>
<p>The <a href="apiconfig.html#principle"><em>AutoConnectConfig::principle</em></a> parameter has the connection disposition, and specifying <strong>AC_PRINCIPLE_RSSI</strong> will attempt to connect to one of the highest RSSI value among multiple available access points. Also You can expect stable WiFi connection by specifying the lower limit of signal strength using <a href="apiconfig.html#minrssi"><em>AutoConnectConfig::minRSSI</em></a>.<br />
Combining these two parameters allows you to filter the destination AP when multiple available access points are found.</p>
<p><a href="apiconfig.html#principle"><em>AutoConnectConfig::principle</em></a> affects the behavior of both 1<sup>st</sup>-WiFi.begin and <a href="advancedusage.html#automatic-reconnect"><strong>autoReconnect</strong></a>. If you specify <strong>AC_PRINCIPLE_RECENT</strong> for the <a href="apiconfig.html#principle"><strong>principle</strong></a>, it will try according to the conventional connection rules, but if you specify <strong>AC_PRINCIPLE_RSSI</strong>, it will try to connect to the access point that is sending the strongest WiFi signal at that time instead of the last accessed AP. Also, the static IPs will be restored from a saved credential instead of AutoConnectConfig. (The values specified by AutoConnectConfig is ignored)</p>
<table>
<tr>
    <th rowspan="2"></th>
    <th rowspan="2">SSID &amp;<br>Password</th>
    <th rowspan="2">AutoConnectConfig<br>::principle</th>
    <th rowspan="2">Which credentials would be selected</th>
    <th rowspan="2">Static IPs</th>
</tr>
<tr>
</tr>
<tr>
    <td rowspan="3">AutoConnect<br>::begin</td>
    <td rowspan="2">NULL specified</td>
    <td>AC_PRINCIPLE_RECENT</td>
    <td>Nothing, depends on SDK saves</td>
    <td>Use the specified value of AutoConnectConfig<br></td>
</tr>
<tr>
    <td>AC_PRINCIPLE_RSSI</td>
    <td>Auto-selected credentials with max RSSI</td>
    <td>Restoring static IPs suitable for the SSID from saved credentials</td>
</tr>
<tr>
    <td>Specified with the Sketch</td>
    <td>Not effective</td>
    <td>By AutoConnect::begin parameters</td>
    <td>Use the specified value of AutoConnectConfig</td>
</tr>
<tr>
    <td rowspan="2">AutoReconnect</td>
    <td rowspan="2">Load from<br>saved credential</td>
    <td>AC_PRINCIPLE_RECENT</td>
    <td>Recently saved SSID would be chosen</td>
    <td rowspan="2">Restoring static IPs suitable for the SSID from saved credentials</td>
</tr>
<tr>
    <td>AC_PRINCIPLE_RSSI</td>
    <td>Auto-selected credentials with max RSSI</td>
</tr>
</table>

<div class="admonition note">
<p class="admonition-title">In ESP32, the difference between the <a href="apiconfig.html#principle"><em>AutoConnectConfig::principle</em></a> and <code>WIFI_ALL_CHANNEL_SCAN</code> in <code>WiFi.begin</code></p>
<p>In ESP32, if there are multiple access points with the same SSID and PW within reach, <code>WiFi.begin</code> with the SSID and PW explicitly specified will scan all radio channels and connect to the AP which has the highest signal strength. This feature has been enabled since <a href="https://github.com/espressif/arduino-esp32/commit/3253de87">ESP32 Arduino Release 1.0.6</a>. The <code>principle</code> setting is slightly different from this feature.<br />
<strong>AutoConnect does not specify the SSID and PW in the 1<sup>st</sup>-WiFi.begin</strong>. It leaves that to the contents stored in the SDK. Even if there is an AP with a stronger signal nearby, it will try to connect to an AP with a <strong>smaller channel number</strong>. However, in the case where <code>autoReconnect</code> setting will attempt to reconnect, AutoConnect will read the SSID and PW from the saved credentials and explicitly pass them to <code>WiFi.begin</code>. Therefore, in this case, the connection will be made to the AP with the highest signal strength by <code>WIFI_ALL_CHANNEL_SCAN</code>. But it is only <strong>valid across multiple APs with the same SSID and PW</strong>.<br />
On the other hand, <strong>AC_PRINCIPLE_RSSI</strong> tries to connect the AP with the strongest signal from the connection candidates after selecting the SSID when multiple APs with different SSIDs are mixed in the reachable range.</p>
</div>
<h2 id="detects-connection-establishment-to-ap">Detects connection establishment to AP<a class="headerlink" href="#detects-connection-establishment-to-ap" title="Permanent link">&para;</a></h2>
<p>The Sketch can detect that the ESP module has established a WiFi connection as a station to the access point. The <a href="api.html#begin">AutoConnect::begin</a> or <a href="api.html#handleclient">AutoConnect::handleClient</a> will transit the control temporarily to the function in the Sketch registered by <a href="api.html#onconnect">AutoConnect::onConnect</a> when the ESP module establish a WiFi connection.<br />
The <strong>ConnectExit</strong> function registered with <a href="api.html#onconnect">AutoConnect::onConnect</a> should have the following types and arguments:</p>
<div class="highlight" style="background: #272822"><pre style="line-height: 125%;"><span></span><code><span style="color: #66d9ef">void</span><span style="color: #f8f8f2"> ConnectExit(IPAddress</span><span style="color: #f92672">&amp;</span><span style="color: #f8f8f2"> ip)</span>
</code></pre></div>
<p>The <strong>ConnectExit</strong> function is of type <em>void</em>. The argument <em>ip</em> is the IP address assigned to the ESP module by the connected AP. <a href="api.html#onconnect">AutoConnect::onConnect</a> allows the Sketch registers a <strong>ConnectExit</strong> function to AutoConnect. Also, you can make the function using a <a href="https://en.cppreference.com/w/cpp/language/lambda"><strong>lambda expression</strong></a>.</p>
<div class="highlight" style="background: #272822"><pre style="line-height: 125%;"><span></span><code><span style="color: #f8f8f2">AutoConnect Portal;</span>

<span style="background-color: #49483e"><span style="color: #66d9ef">void</span><span style="color: #f8f8f2"> </span><span style="color: #a6e22e">onConnect</span><span style="color: #f8f8f2">(IPAddress</span><span style="color: #f92672">&amp;</span><span style="color: #f8f8f2"> ipaddr) {</span>
</span><span style="background-color: #49483e"><span style="color: #f8f8f2">  Serial.print(</span><span style="color: #e6db74">&quot;WiFi connected with &quot;</span><span style="color: #f8f8f2">);</span>
</span><span style="background-color: #49483e"><span style="color: #f8f8f2">  Serial.print(WiFi.SSID());</span>
</span><span style="background-color: #49483e"><span style="color: #f8f8f2">  Serial.print(</span><span style="color: #e6db74">&quot;, IP:&quot;</span><span style="color: #f8f8f2">);</span>
</span><span style="background-color: #49483e"><span style="color: #f8f8f2">  Serial.println(ipaddr.toString());</span>
</span><span style="background-color: #49483e"><span style="color: #f8f8f2">}</span>
</span>
<span style="color: #66d9ef">void</span><span style="color: #f8f8f2"> </span><span style="color: #a6e22e">setup</span><span style="color: #f8f8f2">() {</span>
<span style="color: #f8f8f2">  Serial.begin(</span><span style="color: #ae81ff">115200</span><span style="color: #f8f8f2">);</span>
<span style="background-color: #49483e"><span style="color: #f8f8f2">  Portal.onConnect(onConnect);  </span><span style="color: #75715e">// Register the ConnectExit function</span>
</span><span style="color: #f8f8f2">  Portal.begin();</span>
<span style="color: #f8f8f2">}</span>

<span style="color: #66d9ef">void</span><span style="color: #f8f8f2"> </span><span style="color: #a6e22e">loop</span><span style="color: #f8f8f2">() {</span>
<span style="color: #f8f8f2">  Portal.handleClient();</span>
<span style="color: #f8f8f2">}</span>
</code></pre></div>
<p>In addition, a sketch that shuts down SoftAP when the ESP module connects to the access point can be described using a lambda expression as follows:</p>
<div class="highlight" style="background: #272822"><pre style="line-height: 125%;"><span></span><code><span style="color: #f8f8f2">AutoConnect Portal;</span>

<span style="color: #66d9ef">void</span><span style="color: #f8f8f2"> </span><span style="color: #a6e22e">setup</span><span style="color: #f8f8f2">() {</span>
<span style="color: #f8f8f2">  Serial.begin(</span><span style="color: #ae81ff">115200</span><span style="color: #f8f8f2">);</span>
<span style="background-color: #49483e"><span style="color: #f8f8f2">  Portal.onConnect([](IPAddress</span><span style="color: #f92672">&amp;</span><span style="color: #f8f8f2"> ipaddr){</span>
</span><span style="background-color: #49483e"><span style="color: #f8f8f2">    Serial.printf(</span><span style="color: #e6db74">&quot;WiiFi connected with %s, IP:%s</span><span style="color: #ae81ff">\n</span><span style="color: #e6db74">&quot;</span><span style="color: #f8f8f2">, WiFi.SSID().c_str(), ipaddr.toString().c_str());</span>
</span><span style="background-color: #49483e"><span style="color: #f8f8f2">    </span><span style="color: #66d9ef">if</span><span style="color: #f8f8f2"> (WiFi.getMode() </span><span style="color: #f92672">&amp;</span><span style="color: #f8f8f2"> WIFI_AP) {</span>
</span><span style="background-color: #49483e"><span style="color: #f8f8f2">      WiFi.softAPdisconnect(true);</span>
</span><span style="background-color: #49483e"><span style="color: #f8f8f2">      WiFi.enableAP(false);</span>
</span><span style="background-color: #49483e"><span style="color: #f8f8f2">      Serial.printf(</span><span style="color: #e6db74">&quot;SoftAP:%s shut down</span><span style="color: #ae81ff">\n</span><span style="color: #e6db74">&quot;</span><span style="color: #f8f8f2">, WiFi.softAPSSID().c_str());</span>
</span><span style="background-color: #49483e"><span style="color: #f8f8f2">    }</span>
</span><span style="background-color: #49483e"><span style="color: #f8f8f2">  });</span>
</span><span style="color: #f8f8f2">  Portal.begin();</span>
<span style="color: #f8f8f2">}</span>

<span style="color: #66d9ef">void</span><span style="color: #f8f8f2"> </span><span style="color: #a6e22e">loop</span><span style="color: #f8f8f2">() {</span>
<span style="color: #f8f8f2">  Portal.handleClient();</span>
<span style="color: #f8f8f2">}</span>
</code></pre></div>
<div class="admonition note">
<p class="admonition-title">It is not an event</p>
<p>AutoConnect::onConnect has the same effect on the Sketch as the <a href="https://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/generic-class.html#onevent">WiFi.onStationModeConnected</a>, but AutoConnect does not use the event. Sketch can use <code>WiFi.onEvent</code> independently of AutoConnect.</p>
</div>
<h2 id="match-with-known-access-points-by-ssid">Match with known access points by SSID<a class="headerlink" href="#match-with-known-access-points-by-ssid" title="Permanent link">&para;</a></h2>
<p>By default, AutoConnect uses the <strong>BSSID</strong> to search for known access points. (Usually, it's the MAC address of the device) By using BSSID as the key to finding the WiFi network, AutoConnect can find even if the access point is hidden. However BSSIDs can change on some mobile hotspots, the BSSID-keyed searches may not be able to find known access points.<br />
If you operate inconvenience in aiming at the access point by BSSID, you can change the collation key from BSSID to SSID by uncommenting <code>AUTOCONNECT_APKEY_SSID</code> macro definition in <a href="https://github.com/Hieromon/AutoConnect/blob/master/src/AutoConnectDefs.h#L59"><code>AutoConnectDefs.h</code></a> library source code.</p>
<div class="highlight" style="background: #272822"><pre style="line-height: 125%;"><span></span><code><span style="color: #75715e">#define AUTOCONNECT_APKEY_SSID</span>
</code></pre></div>
<p>Allow you to use <a href="https://platformio.org/platformio-ide">PlatformIO</a> as a build system and give the following description to the <a href="https://docs.platformio.org/en/latest/projectconf/section_env_build.html?highlight=build_flags#build-flags"><code>platformio.ini</code></a>, you can enable <strong>AUTOCONNECT_APKEY_SSID</strong> each build without modifying the library source code:</p>
<div class="highlight" style="background: #272822"><pre style="line-height: 125%;"><span></span><code><span style="color: #a6e22e">build_flags</span><span style="color: #f92672">=</span><span style="color: #e6db74">-DAUTOCONNECT_APKEY_SSID</span>
</code></pre></div>
<div class="admonition info">
<p class="admonition-title">Can't be found hidden APs in SSID-keyed</p>
<p>The hidden access point's SSID will be blank on the broadcast. So if the seek key is an SSID, AutoConnect will not find it.</p>
</div>
<h2 id="preserve-ap-mode">Preserve AP mode<a class="headerlink" href="#preserve-ap-mode" title="Permanent link">&para;</a></h2>
<p>Sketch using AutoConnect can open a gateway to the Internet by connecting to a WiFi router even through use Espressif's peculiar WiFi protocol (e.g. <a href="https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/esp-wifi-mesh.html">ESP-MESH</a> or <a href="https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/network/esp_now.html">ESP-NOW</a>). These specific communication protocols require to keeps AP + STA as the WiFi mode. That is, to apply these protocols, it needs to launch SoftAP by a sketch itself and then call <a href="api.html#begin">AutoConnect::begin</a>. But the default behavior of <a href="api.html#begin">AutoConnect::begin</a> will turn off SoftAP always then it will unable to open a connection.</p>
<p><a href="apiconfig.html#preserveAPMode"><em>AutoConnectConfig::preserveAPMode</em></a> setting maintains WIFI_AP mode without disabling SoftAP inside <a href="api.html#begin">AutoConnect::begin</a>. The Sketch can utilize the WiFi connection via AutoConnect with ESP-MESH and ESP-NOW protocol by enabling this option.</p>
<p>The following diagram quoted from the <a href="https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/esp-wifi-mesh.html">ESP-MESH documentation</a> that illustrates the typical topology of the MESH network. The module located at the Root Node bridges between the mesh network and the router by an application that handles two protocols, TCP/IP and ESP-MESH. Its SoftAP communicates with the internal mesh network as an interface of the mesh layer. On the other hand, STA performs station communication with the WiFi router as an interface of the TCP/IP layer. AutoConnect allows assists the connection between the router and the STA of the Root Node using <a href="apiconfig.html#preserveapmode"><em>AutoConnectConfig::preserveAPMode</em></a> and starting the SoftAP via Sketch separately.</p>
<p><img src="https://docs.espressif.com/projects/esp-idf/en/latest/esp32/_images/mesh-bidirectional-data-stream.png"></p>
<p>Also in general, the Sketch should set <strong>false</strong> to <a href="apiconfig.html#autorise"><em>AutoConnectConfig::autoRise</em></a>, <strong>true</strong> to <a href="apiconfig.html#immediatestart"><em>AutoConnectConfig::immediateStart</em></a> when applying to those protocols.</p>
<h2 id="timeout-settings-for-a-connection-attempt">Timeout settings for a connection attempt<a class="headerlink" href="#timeout-settings-for-a-connection-attempt" title="Permanent link">&para;</a></h2>
<p>AutoConnect uses <a href="apiconfig.html#begintimeout"><em>AutoConnectConfig::beginTimeout</em></a> value to limit time to attempt when connecting the ESP module to the access point as a WiFi station. The default value is <strong>AUTOCONNECT_TIMEOUT</strong> defined in <a href="https://github.com/Hieromon/AutoConnect/blob/master/src/AutoConnectDefs.h#L132"><code>AutoConnectDefs.h</code></a> and the initial value is 30 seconds. (actually specified in milliseconds)<br />
For example, the following sketch sets the connection timeout to 15 seconds:</p>
<div class="highlight" style="background: #272822"><pre style="line-height: 125%;"><span></span><code><span style="color: #f8f8f2">AutoConnect Portal;</span>
<span style="color: #f8f8f2">AutoConnectConfig Config;</span>

<span style="color: #66d9ef">void</span><span style="color: #f8f8f2"> </span><span style="color: #a6e22e">setup</span><span style="color: #f8f8f2">() {</span>
<span style="background-color: #49483e"><span style="color: #f8f8f2">  Config.beginTimeout </span><span style="color: #f92672">=</span><span style="color: #f8f8f2"> </span><span style="color: #ae81ff">15000</span><span style="color: #f8f8f2">; </span><span style="color: #75715e">// Timeout sets to 15[s]</span>
</span><span style="color: #f8f8f2">  Portal.config(Config);</span>
<span style="color: #f8f8f2">  Portal.begin();</span>
<span style="color: #f8f8f2">}</span>

<span style="color: #66d9ef">void</span><span style="color: #f8f8f2"> </span><span style="color: #a6e22e">loop</span><span style="color: #f8f8f2"> () {</span>
<span style="color: #f8f8f2">  Portal.handleClient();</span>
<span style="color: #f8f8f2">}</span>
</code></pre></div>
<p>In addition, the limit of the waiting time for connection attempts can be specified by the <a href="api.html#begin">AutoConnect::begin</a> parameter too. The <em>timeout</em> parameter specified in <a href="api.html#begin">AutoConnect::begin</a> takes precedence over <a href="apiconfig.html#begintimeout"><em>AutoConnectConfig::beginTimeout</em></a>.</p>
<div class="admonition note">
<p class="admonition-title">The beginTimeout has an effect on handleClient</p>
<p>The <a href="apiconfig.html#begintimeout"><strong>beginTimeout</strong></a> value will be applied with <a href="api.html#handleclient"><strong>handleClient</strong></a> when requesting a connection from the captive portal and when attempting to reconnect with <a href="apiconfig.html#autoreconnect"><strong>autoReconnect</strong></a>.</p>
</div>
<h2 id="verify-the-wifi-connection-conditions">Verify the WiFi connection conditions<a class="headerlink" href="#verify-the-wifi-connection-conditions" title="Permanent link">&para;</a></h2>
<p>AutoConnect has the following indicators regarding WiFi connection attempts. These states are indicated as bitwise values and are the logical disjunction of multiple states. For example, if the <em>1<sup>st</sup>-WiFi.begin</em> fails and the connection is restored by the <a href="#automatic-reconnect">AutoConnectConfig::autoReconnect</a> setting, this status value will indicate both <code>AC_AUTORECONNECT</code> and <code>AC_ESTABLISHED</code>.</p>
<p>A sketch can get this status value using the <a href="api.html#portalstatus">AutoConnect::portalStatus</a> function. <a href="api.html#portalstatus">AutoConnect::portalStatus</a> returns a value of type <em>uint8_t</em>. The return value is a bitwise value that indicates each status in the table below. In the sketch, the WiFi connection status is detected by taking the AND of the return value and the <code>enum</code> value shown in the following table:</p>
<table>
<thead>
<tr>
<th>Values of the status indication</th>
<th>WiFi connection situations</th>
</tr>
</thead>
<tbody>
<tr>
<td>AutoConnect::AC_IDLE</td>
<td><strong>Initial state</strong>: This is the initial state, AutoConnect is not making any WiFi connection attempts. This state is reached immediately after <a href="lsbegin.html#autoconnectbegin-logic-sequence">AutoConnect::begin</a> starts.</td>
</tr>
<tr>
<td>AutoConnect::AC_ESTABLISHED</td>
<td><strong>Connection successful</strong>: Successfully connected to the WiFi access point.</td>
</tr>
<tr>
<td>AutoConnect::AC_AUTORECONNECT</td>
<td><strong>The autoReconnect was applied</strong>:  <a href="apiconfig.html#autoreconnect">AutoConnectConfig::autoReconnect</a> setting was applied during the WiFi connection attempt process. This flag does not indicate a successful connection. It only shows that a condition that triggers autoReconnect has occurred. Whether the connection was actually successful should be determined by <code>WiFi.status()==WL_CONNECTED</code>.</td>
</tr>
<tr>
<td>AutoConnect::AC_TIMEOUT</td>
<td><strong>Connection timeout</strong>: WiFi connection attempt timed out. Or, the captive portal was shut down by the <a href="adcpcontrol.html#captive-portal-timeout-control">AutoConnectConfig::portalTimeout</a> setting.</td>
</tr>
<tr>
<td>AutoConnect::AC_INTERRUPT</td>
<td><strong>Connection interrupted due to an indication with the exit</strong>: The <a href="api.html#whileconnecting">whileConnecting exit</a> routine returned false. or the <a href="adcpcontrol.html#sketch-execution-during-the-captive-portal-loop">whileCaptivePortal exit</a> routine returned false. AutoConnect aborted the WiFi connection attempt with those indications.</td>
</tr>
<tr>
<td>AutoConnect::AC_CAPTIVEPORTAL</td>
<td><strong>Captive portal is available</strong>: SoftAP mode is enabled, and the DNS server is available. AutoConnect will redirect connection requests to SoftAP from client devices to a captive portal site within AutoConnect. The state of this flag is equivalent to the return value of <a href="adcpcontrol.html#captive-portal-state-identification">AutoConnect::isPortalAvailable</a> function.<br><strong>NOTE</strong>: AC_CAPTIVEPORTAL is false if only SoftAP is available and no DNS server is enabled.</td>
</tr>
<tr>
<td>AutoConnect::AC_INPROGRESS</td>
<td><strong>WiFi.begin in progress</strong>: AutoConnect requests WiFi.begin and is waiting for the connection to succeed or times out; this state will reset when terminating WiFi.begin attempts.</td>
</tr>
</tbody>
</table>
<div class="highlight" style="background: #272822"><pre style="line-height: 125%;"><span></span><code><span style="color: #f8f8f2">AutoConnect portal;</span>
<span style="color: #f8f8f2">AutoConnectConfig config;</span>

<span style="color: #66d9ef">uint8_t</span><span style="color: #f8f8f2"> state;</span>

<span style="color: #66d9ef">void</span><span style="color: #f8f8f2"> </span><span style="color: #a6e22e">setup</span><span style="color: #f8f8f2">() {</span>
<span style="color: #f8f8f2">  </span><span style="color: #75715e">// Configure automatic reconnection and captive portal retention, then start</span>
<span style="color: #f8f8f2">  </span><span style="color: #75715e">// AutoConnect. In subsequent steps, it will use the portalStatus function to</span>
<span style="color: #f8f8f2">  </span><span style="color: #75715e">// detect the WiFi connection status in this configuration.</span>
<span style="color: #f8f8f2">  config.portalTimeout </span><span style="color: #f92672">=</span><span style="color: #f8f8f2"> </span><span style="color: #ae81ff">180000</span><span style="color: #f8f8f2">;</span>
<span style="color: #f8f8f2">  config.autoReconnect </span><span style="color: #f92672">=</span><span style="color: #f8f8f2"> true;</span>
<span style="color: #f8f8f2">  config.reconnectInterval </span><span style="color: #f92672">=</span><span style="color: #f8f8f2"> </span><span style="color: #ae81ff">1</span><span style="color: #f8f8f2">;</span>
<span style="color: #f8f8f2">  config.retainPortal </span><span style="color: #f92672">=</span><span style="color: #f8f8f2"> true;</span>
<span style="color: #f8f8f2">  portal.config(config);</span>

<span style="color: #f8f8f2">  portal.begin();</span>

<span style="color: #f8f8f2">  state </span><span style="color: #f92672">=</span><span style="color: #f8f8f2"> portal.portalStatus();</span>
<span style="color: #f8f8f2">  </span><span style="color: #66d9ef">if</span><span style="color: #f8f8f2"> (WiFi.status() </span><span style="color: #f92672">==</span><span style="color: #f8f8f2"> WL_CONNECTED) {</span>
<span style="color: #f8f8f2">    </span><span style="color: #66d9ef">if</span><span style="color: #f8f8f2"> (state </span><span style="color: #f92672">&amp;</span><span style="color: #f8f8f2"> AutoConnect</span><span style="color: #f92672">::</span><span style="color: #f8f8f2">AC_AUTORECONNECT)</span>
<span style="color: #f8f8f2">      Serial.println(</span><span style="color: #e6db74">&quot;Auto reconnection applied&quot;</span><span style="color: #f8f8f2">);</span>
<span style="color: #f8f8f2">  }</span>
<span style="color: #f8f8f2">  </span><span style="color: #66d9ef">else</span><span style="color: #f8f8f2"> {</span>
<span style="color: #f8f8f2">    </span><span style="color: #66d9ef">if</span><span style="color: #f8f8f2"> (state </span><span style="color: #f92672">&amp;</span><span style="color: #f8f8f2"> AutoConnect</span><span style="color: #f92672">::</span><span style="color: #f8f8f2">AC_TIMEOUT)</span>
<span style="color: #f8f8f2">      Serial.println(</span><span style="color: #e6db74">&quot;Connection timeout&quot;</span><span style="color: #f8f8f2">);</span>
<span style="color: #f8f8f2">  }</span>

<span style="color: #f8f8f2">  </span><span style="color: #66d9ef">if</span><span style="color: #f8f8f2"> (state </span><span style="color: #f92672">&amp;</span><span style="color: #f8f8f2"> AutoConnect</span><span style="color: #f92672">::</span><span style="color: #f8f8f2">AC_CAPTIVEPORTAL)</span>
<span style="color: #f8f8f2">    Serial.println(</span><span style="color: #e6db74">&quot;Captive portal is still alive&quot;</span><span style="color: #f8f8f2">);</span>
<span style="color: #f8f8f2">  </span><span style="color: #66d9ef">else</span>
<span style="color: #f8f8f2">    Serial.println(</span><span style="color: #e6db74">&quot;Captive portal is not available&quot;</span><span style="color: #f8f8f2">);</span>
<span style="color: #f8f8f2">}</span>

<span style="color: #66d9ef">void</span><span style="color: #f8f8f2"> </span><span style="color: #a6e22e">loop</span><span style="color: #f8f8f2">() {</span>
<span style="color: #f8f8f2">  portal.handleClient();</span>
<span style="color: #f8f8f2">  </span><span style="color: #66d9ef">uint8_t</span><span style="color: #f8f8f2"> transition </span><span style="color: #f92672">=</span><span style="color: #f8f8f2"> portal.portalStatus();</span>

<span style="color: #f8f8f2">  </span><span style="color: #66d9ef">if</span><span style="color: #f8f8f2"> (transition </span><span style="color: #f92672">!=</span><span style="color: #f8f8f2"> state) {</span>
<span style="color: #f8f8f2">    </span><span style="color: #66d9ef">if</span><span style="color: #f8f8f2"> (transition </span><span style="color: #f92672">&amp;</span><span style="color: #f8f8f2"> AutoConnect</span><span style="color: #f92672">::</span><span style="color: #f8f8f2">AC_CAPTIVEPORTAL)</span>
<span style="color: #f8f8f2">      Serial.println(</span><span style="color: #e6db74">&quot;Captive portal activated&quot;</span><span style="color: #f8f8f2">);</span>
<span style="color: #f8f8f2">    </span><span style="color: #66d9ef">if</span><span style="color: #f8f8f2"> (transition </span><span style="color: #f92672">&amp;</span><span style="color: #f8f8f2"> AutoConnect</span><span style="color: #f92672">::</span><span style="color: #f8f8f2">AC_AUTORECONNECT)</span>
<span style="color: #f8f8f2">      Serial.println(</span><span style="color: #e6db74">&quot;Auto reconnection applied&quot;</span><span style="color: #f8f8f2">);</span>
<span style="color: #f8f8f2">    </span><span style="color: #66d9ef">if</span><span style="color: #f8f8f2"> (</span><span style="color: #f92672">!</span><span style="color: #f8f8f2">(transition </span><span style="color: #f92672">&amp;</span><span style="color: #f8f8f2"> AutoConnect</span><span style="color: #f92672">::</span><span style="color: #f8f8f2">AC_ESTABLISHED))</span>
<span style="color: #f8f8f2">      Serial.println(</span><span style="color: #e6db74">&quot;WiFi connection lost&quot;</span><span style="color: #f8f8f2">);</span>

<span style="color: #f8f8f2">    state </span><span style="color: #f92672">=</span><span style="color: #f8f8f2"> transition;</span>
<span style="color: #f8f8f2">  }</span>
<span style="color: #f8f8f2">}</span>
</code></pre></div>
<div class="admonition info">
<p class="admonition-title">AutoConnect::portalStatus within the loop of AutoConnect::handleClient</p>
<p>AutoConnect::portalStatus function is also valid during the <a href="api.html#handleclient">AutoConnect::handleClient</a> loop inside the <code>loop</code> function. With the <a href="adconnection.html#automatic-reconnect-background">background reconnection</a> enabled using the <a href="apiconfig.html#autoreconnect">AutoConnectConfig::autoReconnect</a> and <a href="apiconfig.html#reconnectinterval">AutoConnectConfig::reconnectInterval</a> settings, the <a href="api.html#portalstatus">AutoConnect::portalStatus</a> function will return a value indicating the reconnection status at every time <a href="api.html#handleclient">AutoConnect::handleClient</a> in the <code>loop()</code>.</p>
</div>


  




                
              </article>
            </div>
          
          
        </div>
        
          <a href="#" class="md-top md-icon" data-md-component="top" hidden>
            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12Z"/></svg>
            Back to top
          </a>
        
      </main>
      
        <footer class="md-footer">
  
  <div class="md-footer-meta md-typeset">
    <div class="md-footer-meta__inner md-grid">
      <div class="md-copyright">
  
    <div class="md-copyright__highlight">
      Copyright &copy; 2018-2023 Hieromon Ikasamo
    </div>
  
  
    Made with
    <a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
      Material for MkDocs
    </a>
  
</div>
      
        <div class="md-social">
  
    
    
      
      
    
    <a href="https://github.com/Hieromon" target="_blank" rel="noopener" title="github.com" class="md-social__link">
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><!--! Font Awesome Free 6.2.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc.--><path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"/></svg>
    </a>
  
    
    
      
      
    
    <a href="https://twitter.com/hieromon" target="_blank" rel="noopener" title="twitter.com" class="md-social__link">
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.2.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc.--><path d="M459.37 151.716c.325 4.548.325 9.097.325 13.645 0 138.72-105.583 298.558-298.558 298.558-59.452 0-114.68-17.219-161.137-47.106 8.447.974 16.568 1.299 25.34 1.299 49.055 0 94.213-16.568 130.274-44.832-46.132-.975-84.792-31.188-98.112-72.772 6.498.974 12.995 1.624 19.818 1.624 9.421 0 18.843-1.3 27.614-3.573-48.081-9.747-84.143-51.98-84.143-102.985v-1.299c13.969 7.797 30.214 12.67 47.431 13.319-28.264-18.843-46.781-51.005-46.781-87.391 0-19.492 5.197-37.36 14.294-52.954 51.655 63.675 129.3 105.258 216.365 109.807-1.624-7.797-2.599-15.918-2.599-24.04 0-57.828 46.782-104.934 104.934-104.934 30.213 0 57.502 12.67 76.67 33.137 23.715-4.548 46.456-13.32 66.599-25.34-7.798 24.366-24.366 44.833-46.132 57.827 21.117-2.273 41.584-8.122 60.426-16.243-14.292 20.791-32.161 39.308-52.628 54.253z"/></svg>
    </a>
  
</div>
      
    </div>
  </div>
</footer>
      
    </div>
    <div class="md-dialog" data-md-component="dialog">
      <div class="md-dialog__inner md-typeset"></div>
    </div>
    
    <script id="__config" type="application/json">{"base": ".", "features": ["navigation.top"], "search": "assets/javascripts/workers/search.db81ec45.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}}</script>
    
    
      <script src="assets/javascripts/bundle.a00a7c5e.min.js"></script>
      
        <script src="js/gifffer.min.js"></script>
      
    
  </body>
</html>